#!/usr/bin/perl -w


#encodeUrl.pl. A Perl library for URL codification.

sub encode_url
{
	local($url) = @_;

	$url =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;

	return $url; 
}

sub decode_url
{
	local($url) = @_;

	$url =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg;

	return $url; 
}

return 1;